home *** CD-ROM | disk | FTP | other *** search
Prolog Source | 1986-10-07 | 890 b | 32 lines |
- /* Program 38 */
- /*
- NOTE: all graphics programs are in white on a
- black(blue) background. If you don't like this
- combination it can easily be changed. You
- can change the parameters to the 'graphics'
- predicate, or you can change the drawing
- color. Read page 92 and try some combinations
- of parameters. For example: graphics(1,5,17)
- on a CGA will give you pink letters and a
- white line on a blue background. Other systems
- give different colors. Just explore.
- */
-
- predicates
- square(integer)
- fillsquare(integer)
-
- goal
- graphics(1,1,0),
- penpos(0,0,90),
- pencolor(7),
- fillsquare(5000).
-
- clauses
- square(X):-
- forward(X),right(90),forward(X),right(90),
- forward(X),right(90),forward(X),right(90).
- fillsquare(X):-X>30000,!.
- fillsquare(X):-square(X),Y=X+500,fillsquare(Y).
-